/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Coupled.java
 *
 * Created on 23 бер 2010, 9:50:22
 */

package jmeshless;

import Integration.GaussQuadrature;
import MF1DSolver.CoupledResult;
import MF1DSolver.MF1SolverLagrangeCoupled;
import MeshlessShapeFunctions.IKernelFunction;
import MeshlessShapeFunctions.JCubicSpline;
import MeshlessShapeFunctions.JExponential;
import MeshlessShapeFunctions.JGaussian;
import MeshlessShapeFunctions.JStKernel;
import java.awt.Dimension;
import javax.swing.JFrame;

import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;

/**
 *
 * @author mark_o
 */
public class AutoCoupled extends javax.swing.JPanel {

    /**
	 * 
	 */
	private static final long serialVersionUID = -6232058357517536289L;


	/** Creates new form Coupled */
    public AutoCoupled() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextFieldP = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldQ = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldW = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldF = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jComboBoxA = new javax.swing.JComboBox();
        jTextFieldBLeft = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jComboBoxB = new javax.swing.JComboBox();
        jTextFieldBRight = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldA = new javax.swing.JTextField();
        jTextFieldB = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jTextFieldN1 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jComboBoxKernal = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        jTextFieldPow1 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTextFieldRho1 = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jTextFieldN2 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTextFieldDivPointA = new javax.swing.JTextField();
        jTextFieldDivPointB = new javax.swing.JTextField();
        jTextFieldNNN = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jTextFieldNorma = new javax.swing.JTextField();

        setPreferredSize(new Dimension(312, 502));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Параметри"));

        jLabel1.setText("p");

        jTextFieldP.setText("1");

        jLabel2.setText("q");

        jTextFieldQ.setText("0");
        jTextFieldQ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldQActionPerformed(evt);
            }
        });

        jLabel3.setText("w");

        jTextFieldW.setText("100");
        jTextFieldW.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldWActionPerformed(evt);
            }
        });

        jLabel4.setText("f");

        jTextFieldF.setText("100");

        javax.swing.GroupLayout gl_jPanel1 = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(gl_jPanel1);
        gl_jPanel1.setHorizontalGroup(
            gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel1.createSequentialGroup()
                .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(gl_jPanel1.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldP, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE))
                    .addGroup(gl_jPanel1.createSequentialGroup()
                        .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4))
                        .addGap(18, 18, 18)
                        .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldW, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)
                            .addComponent(jTextFieldQ, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)
                            .addComponent(jTextFieldF, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE))))
                .addContainerGap())
        );
        gl_jPanel1.setVerticalGroup(
            gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel1.createSequentialGroup()
                .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextFieldP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jTextFieldQ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jTextFieldW, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel1.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextFieldF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Граничні умови"));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Ліва"));

        jComboBoxA.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Діріхле", "Неймана" }));
        jComboBoxA.setEnabled(false);

        jTextFieldBLeft.setText("0");
        jTextFieldBLeft.setEnabled(false);

        javax.swing.GroupLayout gl_jPanel3 = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(gl_jPanel3);
        gl_jPanel3.setHorizontalGroup(
            gl_jPanel3.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jComboBoxA, 0, 116, Short.MAX_VALUE)
            .addComponent(jTextFieldBLeft, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
        );
        gl_jPanel3.setVerticalGroup(
            gl_jPanel3.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel3.createSequentialGroup()
                .addComponent(jComboBoxA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldBLeft, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Права"));

        jComboBoxB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Діріхле", "Неймана" }));
        jComboBoxB.setEnabled(false);

        jTextFieldBRight.setText("0");
        jTextFieldBRight.setEnabled(false);
        jTextFieldBRight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldBRightActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout gl_jPanel4 = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(gl_jPanel4);
        gl_jPanel4.setHorizontalGroup(
            gl_jPanel4.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jComboBoxB, 0, 140, Short.MAX_VALUE)
            .addComponent(jTextFieldBRight, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
        );
        gl_jPanel4.setVerticalGroup(
            gl_jPanel4.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel4.createSequentialGroup()
                .addComponent(jComboBoxB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldBRight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout gl_jPanel2 = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(gl_jPanel2);
        gl_jPanel2.setHorizontalGroup(
            gl_jPanel2.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel2.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        gl_jPanel2.setVerticalGroup(
            gl_jPanel2.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel2.createSequentialGroup()
                .addGroup(gl_jPanel2.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Проміжок"));

        jLabel5.setText("a");

        jTextFieldA.setText("0");
        jTextFieldA.setEnabled(false);

        jTextFieldB.setText("1");
        jTextFieldB.setEnabled(false);

        jLabel6.setText("b");

        javax.swing.GroupLayout gl_jPanel5 = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(gl_jPanel5);
        gl_jPanel5.setHorizontalGroup(
            gl_jPanel5.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel5.createSequentialGroup()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldA, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldB, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22))
        );
        gl_jPanel5.setVerticalGroup(
            gl_jPanel5.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel5.createSequentialGroup()
                .addGroup(gl_jPanel5.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jTextFieldA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Апроксимація безсітковим"));

        jLabel11.setText("n");

        jTextFieldN1.setText("15");

        jLabel12.setText("Ядро");

        jComboBoxKernal.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Гаусіан", "Кубічний сплайн", "Експонентційна", "Експонентційна_2" }));

        jLabel13.setText("Степінь");

        jTextFieldPow1.setText("1");

        jLabel14.setText("Радіус");

        jTextFieldRho1.setText("2.33");

        javax.swing.GroupLayout gl_jPanel7 = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(gl_jPanel7);
        gl_jPanel7.setHorizontalGroup(
            gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gl_jPanel7.createSequentialGroup()
                .addContainerGap()
                .addGroup(gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTextFieldN1)
                    .addComponent(jComboBoxKernal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(gl_jPanel7.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldPow1, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE))
                    .addGroup(gl_jPanel7.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTextFieldRho1, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)))
                .addContainerGap())
        );
        gl_jPanel7.setVerticalGroup(
            gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel7.createSequentialGroup()
                .addGroup(gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jTextFieldN1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(jTextFieldPow1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel7.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jComboBoxKernal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14)
                    .addComponent(jTextFieldRho1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Апроксимація МСЕ"));

        jTextFieldN2.setText("5");

        jLabel15.setText("n");

        jLabel16.setText("поділ");

        jTextFieldDivPointA.setText("0.85");
        jTextFieldDivPointA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldDivPointAActionPerformed(evt);
            }
        });

        jTextFieldDivPointB.setText("0.99");
        jTextFieldDivPointB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldDivPointBActionPerformed(evt);
            }
        });

        jTextFieldNNN.setText("10");

        jButton1.setText("Розвязати");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextFieldNorma.setText(" ");

        javax.swing.GroupLayout gl_jPanel8 = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(gl_jPanel8);
        gl_jPanel8.setHorizontalGroup(
            gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel8.createSequentialGroup()
                .addGroup(gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(gl_jPanel8.createSequentialGroup()
                        .addGroup(gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(gl_jPanel8.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addGap(38, 38, 38)
                                .addComponent(jTextFieldN2, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel16))
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)
                        .addGroup(gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(gl_jPanel8.createSequentialGroup()
                                .addComponent(jTextFieldDivPointA, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldDivPointB, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
                            .addComponent(jTextFieldNNN, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gl_jPanel8.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTextFieldNorma, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)))
                .addContainerGap())
        );
        gl_jPanel8.setVerticalGroup(
            gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gl_jPanel8.createSequentialGroup()
                .addGroup(gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jTextFieldN2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(jTextFieldDivPointA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldDivPointB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(gl_jPanel8.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFieldNNN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldNorma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        layout.setHorizontalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        		.addComponent(jPanel2, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        		.addComponent(jPanel5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        		.addComponent(jPanel7, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        		.addComponent(jPanel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addGap(1)
        			.addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jPanel5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jPanel7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jPanel8, GroupLayout.PREFERRED_SIZE, 114, GroupLayout.PREFERRED_SIZE)
        			.addContainerGap(253, Short.MAX_VALUE))
        );
        this.setLayout(layout);
    }// </editor-fold>//GEN-END:initComponents

    private void jTextFieldQActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldQActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldQActionPerformed

    private void jTextFieldWActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldWActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldWActionPerformed

    private void jTextFieldBRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldBRightActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldBRightActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        int nn = Integer.parseInt(this.jTextFieldN1.getText());
        final int N = Integer.parseInt(this.jTextFieldN2.getText());
        final int NNN = Integer.parseInt(this.jTextFieldNNN.getText());
        int Degree = Integer.parseInt(this.jTextFieldPow1.getText());
        double a = Double.parseDouble(this.jTextFieldA.getText());
        double b = Double.parseDouble(this.jTextFieldB.getText());
        double left = Double.parseDouble(this.jTextFieldBLeft.getText());
        double divPointA = Double.parseDouble(this.jTextFieldDivPointA.getText());
        double divPointB = Double.parseDouble(this.jTextFieldDivPointB.getText());
        boolean DirihletA = true;
        if(this.jComboBoxA.getSelectedIndex()==1){
            DirihletA = false;
        }
        boolean DirihletB = true;
        if(this.jComboBoxB.getSelectedIndex()==1){
            DirihletB = false;
        }
        double right = Double.parseDouble(this.jTextFieldBRight.getText());
        String p = this.jTextFieldP.getText();
        String q = this.jTextFieldQ.getText();
        String w = this.jTextFieldW.getText();
        String f = this.jTextFieldF.getText();
            IKernelFunction kernal = null;
                switch(jComboBoxKernal.getSelectedIndex()){
                    case 0: kernal = new JGaussian(1); break;
                    case 1: kernal = new JCubicSpline(1); break;
                    case 2: kernal = new JExponential(1,0.7); break;
                    case 3: kernal = new JStKernel(1); break;
                    //case 4: kernal = new JSt2Kernel(); break;
                    default: kernal = new JGaussian(1);
                }
            double rho = Double.parseDouble(this.jTextFieldRho1.getText());

//        ArrayList<Particle> ls1D = new ArrayList<Particle>();

        MF1SolverLagrangeCoupled s = new MF1SolverLagrangeCoupled();
        CoupledResult res = s.autoCoupling(divPointA, divPointB, N, nn,NNN, Degree,  kernal, rho);

        XYSeries series1 = new XYSeries("розвязок", true, true);
        double H = (b-a)/10000.0;
        for (int i = 0; i < 10000; i++) {
            series1.add(a+H*i,res.calculate(a+H*i));
        }
        NewOkCancelDialog dialog = new NewOkCancelDialog(null, false, new XYSeriesCollection(series1));
            dialog.setLocationRelativeTo(null);
            //dialog.setUndecorated(true);
            dialog.setVisible(true);



            GaussQuadrature gau = new GaussQuadrature(100);
            double r = (gau.Gauss(a, b, 0.000001, res));

//            double r = (gau.Gauss(a, b, 0.000001, new IFunction1D() {
//
//                public double calculate(double x) {
//                    if (x<divPoint) {
//                        double tmp = 0.0;
//                        for (int j = 0; j <listFEM.size(); j++) {
//                            tmp+= listFEM.get(j).calculate(x)*res[j];
//                        }
//                        return tmp*tmp;
//                    }else{
//                        double tmp = 0.0;
//                        for (int j = 0; j <MeshlessShapeList.size(); j++) {
//                            tmp+= MeshlessShapeList.get(j).calculate(x)*res[j+N];
//                        }
//                        return tmp*tmp;
//                    }
//
//                }
//
//                public double calculateDerivaty(double x) {
//                    throw new UnsupportedOperationException("Not supported yet.");
//                }
//            }));
            this.jTextFieldNorma.setText(r+"");
            System.out.println(r);

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jTextFieldDivPointAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDivPointAActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldDivPointAActionPerformed

    private void jTextFieldDivPointBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDivPointBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldDivPointBActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox jComboBoxA;
    private javax.swing.JComboBox jComboBoxB;
    private javax.swing.JComboBox jComboBoxKernal;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JTextField jTextFieldA;
    private javax.swing.JTextField jTextFieldB;
    private javax.swing.JTextField jTextFieldBLeft;
    private javax.swing.JTextField jTextFieldBRight;
    private javax.swing.JTextField jTextFieldDivPointA;
    private javax.swing.JTextField jTextFieldDivPointB;
    private javax.swing.JTextField jTextFieldF;
    private javax.swing.JTextField jTextFieldN1;
    private javax.swing.JTextField jTextFieldN2;
    private javax.swing.JTextField jTextFieldNNN;
    private javax.swing.JTextField jTextFieldNorma;
    private javax.swing.JTextField jTextFieldP;
    private javax.swing.JTextField jTextFieldPow1;
    private javax.swing.JTextField jTextFieldQ;
    private javax.swing.JTextField jTextFieldRho1;
    private javax.swing.JTextField jTextFieldW;
    // End of variables declaration//GEN-END:variables


    public static void main(String[] args){
        AutoCoupled p = new AutoCoupled();
        JFrame f = new JFrame("одновимірна задача");
        f.getContentPane().add(p);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setMinimumSize(new Dimension(322, 528));
        f.setResizable(false);
        f.setSize(322, 528);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }
}
